﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using Tools;
using DAL;

namespace BLL
{
   public class ManageUserBLL
    {
        public static UserInfo LoginUser(string LoginName, string UserPwd)
        {
            List<UserInfo> userdata = ManageUserDAL.userdata();
            UserInfo user = userdata.Where(u => u.LoginName == LoginName && u.UserPwd == UserPwd).SingleOrDefault();
            return user;
        }
        public static string register(UserInfo item)
        {

            if (item.LoginName == null && item.UserPwd == null)
            {
                return "用户名或密码不能为空";
            }
            else
            {
                ManageUserDAL.register(item);
                return "添加成功";
            }

        }
    }
}
